#include "resources.h"

Sprite_Container sprite_container;


Sprite_Container::Sprite_Container()
{
}

Sprite_Container::~Sprite_Container()
{
	sprites.clear();
}

void Sprite_Container::Load(CL_GraphicContext &gc, CL_ResourceManager &resources)
{
	std::vector<CL_String> resource_names = resources.get_resource_names_of_type("sprite");
	for (size_t i = 0; i < resource_names.size(); i++)
		sprites[resource_names[i].c_str()] = CL_Sprite(gc, resource_names[i], &resources);
}

CL_Sprite* Sprite_Container::GetSprite(CL_String name)
{
	if (sprites.find(name.c_str()) != sprites.end())
		return &sprites[name.c_str()];
	else
		return 0;
}
